package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum BookingStatus {
	PAYMENT(0,"未付款(定金)"),
	CONFIRM(1,"待确认"),
	COMPLETE(2,"待完成"),
	CLOSE(3,"已关闭");
	
	private Integer value;
	private String text;
	
	private BookingStatus(int value,String text){
		this.value = value;
		this.text = text;
	}
	
	public Integer toIntValue(){
		return this.value;
	}
	
	public String toStringText(){
		return this.text;
	}
	
	public static BookingStatus toStatus(Integer value) {
		if (CONFIRM.value == value) {
			return CONFIRM;
		} else if (COMPLETE.value == value) {
			return COMPLETE;
		}else if (CLOSE.value == value) {
			return CLOSE;
		} else {
			throw new InvalidArgumentException("Unknown BookingStatus[" + value + "].");
		}
	}
}
